<?php
	class IndexAction extends BaseAction {
		
		public function index(){
			$this->display();
		}
		
		public function upload(){
			import('ORG.Util.upyun');
			$upload = new delayupload();
			$result = $upload->upload('shop',$_FILES['shoppic']);
			$aid = D('attachment')->add($result);
			dump($result);
			$this->show('<img src="http://rencai.b0.upaiyun.com'.$result['path'].'" />');
		}
		public function chongzhi(){
			$money = 1;
			$phone = $_GET['phone'];
			$userid= "A1021937";
			$userpws="199007298ba69f00df9dbde94be66410";
			$url = "http://api2.ofpay.com";
			$url1=$url."/telquery.do?userid=".$userid."&userpws=".$userpws."&phoneno=".$phone."&pervalue=".$money."&version=6.0";
			$xml = file_get_contents($url1);
			$xml = simplexml_load_string($xml);
			$retcode= $xml->retcode;
			$cardid= $xml->cardid;
			if($retcode == 1){
				$sporder_time = date("YmdHis",time());
				$sporder_id = 's'.$sporder_time.time();
				$KeyStr = "OFCARD";
				$md = $userid.$userpws.$cardid.$money.$sporder_id.$sporder_time.$phone.$KeyStr;
				$md = md5($md);
				$md5_str = strtoupper($md); 
				$url2 = $url."/onlineorder.do?userid=".$userid."&userpws=".$userpws."&cardid=".$cardid."&cardnum=".$money."&sporder_id=".$sporder_id."&sporder_time=".$sporder_time."&game_userid=".$phone."&md5_str=".$md5_str."&ret_url=&version=6.0";
				//http://api2.ofpay.com/onlineorder.do?userid=A1021937&userpws=199007298ba69f00df9dbde94be66410&cardid=140101&cardnum=1&sporder_id=20070323140214&sporder_time=20070323140214&game_userid=15000167757&md5_str=F5DB116438F8015C8816E610D10A7BAD&ret_url=&version=6.0
				$xml2 = file_get_contents($url2);
				$xml2 = simplexml_load_string($xml2);
				echo $retcode2= $xml2->retcode;
			}
		}
	}
?>